package DesignPatern.A06_代理模式.QXB.A06动态代理01;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Proxy;

/**
 * @Author: Du
 * @Date: 2021/7/22 11:04
 *
 * 动态代理
 *
 */
public class A01_Main
{
    public static void main(String[] args)
    {
        IGamePlayer player = new GamePlayer("zs");
        InvocationHandler gamePlayIH = new GamePlayIH(player);
        IGamePlayer proxy = (IGamePlayer) Proxy.newProxyInstance(player.getClass().getClassLoader(), player.getClass().getInterfaces(), gamePlayIH);
        proxy.login();
        proxy.killBoss();
        proxy.update();
    }
}
